home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / comms / other / slrn / slrn_src / src / charmaps.h < prev    next >
C/C++ Source or Header  |  1999-05-14  |  12KB  |  308 lines

  1. /* Copyright (c) 1998 John E. Davis (davis@space.mit.edu)
  2.  *
  3.  * This file is part of slrn.
  4.  *
  5.  * Slrn is free software; you can redistribute it and/or modify it
  6.  * under the terms of the GNU General Public License as published by the
  7.  * Free Software Foundation; either version 2, or (at your option) any
  8.  * later version.
  9.  * 
  10.  * Slrn is distributed in the hope that it will be useful, but WITHOUT
  11.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12.  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13.  * for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with Slrn; see the file COPYING.  If not, write to the Free
  17.  * Software Foundation, 59 Temple Place - Suite 330, 
  18.  * Boston, MA  02111-1307, USA.
  19.  */
  20.  
  21. /* This file is only included by chmap.c.  It is separated from it for easy
  22.  * maintainence of the various character sets.
  23.  */
  24.  
  25. #define HAVE_KOI8_CHARMAP       1
  26. #define HAVE_NEXT_CHARMAP    1
  27. #define HAVE_IBM850_CHARMAP    1
  28.  
  29. #define MAX_CHARMAPS        4      /* add 1 for ISO Latin (default) */
  30.  
  31. typedef struct
  32. {
  33.    char *map_name;
  34.    unsigned char display_eight_bit;
  35.    unsigned char to_iso_map [256];
  36.    unsigned char from_iso_map [256];
  37. }
  38. CharMap_Type;
  39.  
  40. #if HAVE_IBM850_CHARMAP
  41. static CharMap_Type IBM850_Char_Map =
  42. {
  43.    "ibm850", 128,
  44.    /* to_iso_map */
  45.      {
  46.      /* Conversion table from `cp850' charset to `iso88591' charset.
  47.       * Generated mechanically by GNU recode 3.4.
  48.       * 
  49.       *  The recoding should be reversible.
  50.       */
  51.     0,   1,   2,   3,   4,   5,   6,   7,    /*   0 -   7 */
  52.     8,   9,  10,  11,  12,  13,  14,  15,    /*   8 -  15 */
  53.     16,  17,  18,  19,  20,  21,  22,  23,    /*  16 -  23 */
  54.     24,  25,  26,  27,  28,  29,  30,  31,    /*  24 -  31 */
  55.     32,  33,  34,  35,  36,  37,  38,  39,    /*  32 -  39 */
  56.     40,  41,  42,  43,  44,  45,  46,  47,    /*  40 -  47 */
  57.     48,  49,  50,  51,  52,  53,  54,  55,    /*  48 -  55 */
  58.     56,  57,  58,  59,  60,  61,  62,  63,    /*  56 -  63 */
  59.     64,  65,  66,  67,  68,  69,  70,  71,    /*  64 -  71 */
  60.     72,  73,  74,  75,  76,  77,  78,  79,    /*  72 -  79 */
  61.     80,  81,  82,  83,  84,  85,  86,  87,    /*  80 -  87 */
  62.     88,  89,  90,  91,  92,  93,  94,  95,    /*  88 -  95 */
  63.     96,  97,  98,  99, 100, 101, 102, 103,    /*  96 - 103 */
  64.     104, 105, 106, 107, 108, 109, 110, 111,    /* 104 - 111 */
  65.     112, 113, 114, 115, 116, 117, 118, 119,    /* 112 - 119 */
  66.     120, 121, 122, 123, 124, 125, 126, 127,    /* 120 - 127 */
  67.     199, 252, 233, 226, 228, 224, 229, 231,    /* 128 - 135 */
  68.     234, 235, 232, 239, 238, 236, 196, 197,    /* 136 - 143 */
  69.     201, 230, 198, 244, 246, 242, 251, 249,    /* 144 - 151 */
  70.     255, 214, 220, 248, 163, 216, 215, 159,    /* 152 - 159 */
  71.     225, 237, 243, 250, 241, 209, 170, 186,    /* 160 - 167 */
  72.     191, 174, 172, 189, 188, 161, 171, 187,    /* 168 - 175 */
  73.     155, 157, 141, 129, 139, 193, 194, 192,    /* 176 - 183 */
  74.     169, 150, 132, 175, 184, 162, 165, 151,    /* 184 - 191 */
  75.     183, 181, 147, 128, 142, 143, 227, 195,    /* 192 - 199 */
  76.     131, 144, 146, 133, 135, 153, 158, 164,    /* 200 - 207 */
  77.     240, 208, 202, 203, 200, 134, 205, 206,    /* 208 - 215 */
  78.     207, 137, 130, 136, 154, 166, 204, 152,    /* 216 - 223 */
  79.     211, 223, 212, 210, 245, 213, 145, 222,    /* 224 - 231 */
  80.     254, 218, 219, 217, 253, 221, 140, 180,    /* 232 - 239 */
  81.     173, 177, 149, 190, 182, 167, 247, 148,    /* 240 - 247 */
  82.     176, 168, 156, 185, 179, 178, 138, 160    /* 248 - 255 */
  83.      },
  84.    /* from_iso_map */
  85.      {
  86.      /* Conversion table from `iso88591' charset to `cp850' charset.
  87.       * Generated mechanically by GNU recode 3.4.
  88.       *
  89.       * The recoding should be reversible.
  90.       */
  91.     0,   1,   2,   3,   4,   5,   6,   7,    /*   0 -   7 */
  92.     8,   9,  10,  11,  12,  13,  14,  15,    /*   8 -  15 */
  93.     16,  17,  18,  19,  20,  21,  22,  23,    /*  16 -  23 */
  94.     24,  25,  26,  27,  28,  29,  30,  31,    /*  24 -  31 */
  95.     32,  33,  34,  35,  36,  37,  38,  39,    /*  32 -  39 */
  96.     40,  41,  42,  43,  44,  45,  46,  47,    /*  40 -  47 */
  97.     48,  49,  50,  51,  52,  53,  54,  55,    /*  48 -  55 */
  98.     56,  57,  58,  59,  60,  61,  62,  63,    /*  56 -  63 */
  99.     64,  65,  66,  67,  68,  69,  70,  71,    /*  64 -  71 */
  100.     72,  73,  74,  75,  76,  77,  78,  79,    /*  72 -  79 */
  101.     80,  81,  82,  83,  84,  85,  86,  87,    /*  80 -  87 */
  102.     88,  89,  90,  91,  92,  93,  94,  95,    /*  88 -  95 */
  103.     96,  97,  98,  99, 100, 101, 102, 103,    /*  96 - 103 */
  104.     104, 105, 106, 107, 108, 109, 110, 111,    /* 104 - 111 */
  105.     112, 113, 114, 115, 116, 117, 118, 119,    /* 112 - 119 */
  106.     120, 121, 122, 123, 124, 125, 126, 127,    /* 120 - 127 */
  107.     195, 179, 218, 200, 186, 203, 213, 204,    /* 128 - 135 */
  108.     219, 217, 254, 180, 238, 178, 196, 197,    /* 136 - 143 */
  109.     201, 230, 202, 194, 247, 242, 185, 191,    /* 144 - 151 */
  110.     223, 205, 220, 176, 250, 177, 206, 159,    /* 152 - 159 */
  111.     255, 173, 189, 156, 207, 190, 221, 245,    /* 160 - 167 */
  112.     249, 184, 166, 174, 170, 240, 169, 187,    /* 168 - 175 */
  113.     248, 241, 253, 252, 239, 193, 244, 192,    /* 176 - 183 */
  114.     188, 251, 167, 175, 172, 171, 243, 168,    /* 184 - 191 */
  115.     183, 181, 182, 199, 142, 143, 146, 128,    /* 192 - 199 */
  116.     212, 144, 210, 211, 222, 214, 215, 216,    /* 200 - 207 */
  117.     209, 165, 227, 224, 226, 229, 153, 158,    /* 208 - 215 */
  118.     157, 235, 233, 234, 154, 237, 231, 225,    /* 216 - 223 */
  119.     133, 160, 131, 198, 132, 134, 145, 135,    /* 224 - 231 */
  120.     138, 130, 136, 137, 141, 161, 140, 139,    /* 232 - 239 */
  121.     208, 164, 149, 162, 147, 228, 148, 246,    /* 240 - 247 */
  122.     155, 151, 163, 150, 129, 236, 232, 152    /* 248 - 255 */
  123.      }
  124. };
  125. #endif
  126.  
  127. #if HAVE_NEXT_CHARMAP
  128. static CharMap_Type NeXT_Char_Map =
  129. {
  130.    "NeXT", 128,
  131.    
  132.    /* to_iso_map */
  133.      {
  134.     0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
  135.     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  136.     0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
  137.     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
  138.     0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
  139.     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
  140.     0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
  141.     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
  142.     0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
  143.     0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,
  144.     0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
  145.     0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,
  146.     0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
  147.     0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
  148.     0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
  149.     0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
  150.     0xa0,0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc7,
  151.     0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,
  152.     0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd9,
  153.     0xda,0xdb,0xdc,0xdd,0xde,0xb5,0xd7,0xf7,
  154.     0xa9,0xa1,0xa2,0xa3,0x2f,0xa5,0x66,0xa7,
  155.     0xa4,0xb4,0x22,0xab,0x5b,0x5d,0x3f,0x3f,
  156.     0xae,0x3f,0x3f,0x3f,0xb7,0xa6,0xb6,0xb7,
  157.     0xb8,0x22,0x22,0xbb,0xb0,0x3f,0xac,0xbf,
  158.     0xb9,0x60,0xb4,0x5e,0x7e,0xaf,0x3f,0xb7,
  159.     0xa8,0x82,0xb0,0xb8,0xb3,0xa8,0x3f,0x3f,
  160.     0x3f,0xb1,0xbc,0xbd,0xbe,0xe0,0xe1,0xe2,
  161.     0xe3,0xe4,0xe5,0xe7,0xe8,0xe9,0xea,0xeb,
  162.     0xec,0xc6,0xed,0xaa,0xee,0xef,0xf0,0xf1,
  163.     0xa3,0xd8,0x4f,0xba,0xf2,0xf3,0xf4,0xf5,
  164.     0xf6,0xe6,0xf9,0xfa,0xfb,0x69,0xfc,0xfd,
  165.     0x6c,0xf8,0x6f,0xdf,0xfe,0xff,0x3f,0x3f
  166.      },
  167.    
  168.    /* from_iso_map */
  169.      {
  170.     0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
  171.     0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
  172.     0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
  173.     0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
  174.     0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,
  175.     0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,
  176.     0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,
  177.     0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,
  178.     0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,
  179.     0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,
  180.     0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,
  181.     0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,
  182.     0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,
  183.     0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,
  184.     0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,
  185.     0x78,0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,
  186.     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
  187.     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
  188.     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
  189.     0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,0x3f,
  190.     0x80,0xa1,0xa2,0xa3,0xa8,0xa5,0xb5,0xa7,
  191.     0xc8,0xa0,0xe3,0xab,0xbe,0x2d,0xb0,0xc5,
  192.     0xca,0xd1,0xc9,0xcc,0xc2,0x9d,0xb6,0xb4,
  193.     0xcb,0xc0,0xeb,0xbb,0xd2,0xd3,0xd4,0xbf,
  194.     0x81,0x82,0x83,0x84,0x85,0x86,0xe1,0x87,
  195.     0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,
  196.     0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x9e,
  197.     0xe9,0x97,0x98,0x99,0x9a,0x9b,0x9c,0xfb,
  198.     0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xf1,0xdb,
  199.     0xdc,0xdd,0xde,0xdf,0xe0,0xe2,0xe4,0xe5,
  200.     0xe6,0xe7,0xec,0xed,0xee,0xef,0xf0,0x9f,
  201.     0xf9,0xf2,0x